import 'package:flutter/material.dart';
import 'package:hi_flutter/app_page.dart';

class ConstraintsDemoPage extends StatelessWidget {
  const ConstraintsDemoPage({super.key});

  @override
  Widget build(BuildContext context) {
    return AppPage(
      body: Column(
        children: [
          ConstrainedBox(
            constraints: const BoxConstraints(
                minWidth: double.infinity, minHeight: 50.0),
            child: const SizedBox(
              height: 5.0,
              child: DecoratedBox(
                decoration: BoxDecoration(color: Colors.red),
              ),
            ),
          ),
          const SizedBox(height: 10),
          ConstrainedBox(
            constraints: const BoxConstraints(minWidth: 20, minHeight: 90),
            child: ConstrainedBox(
              constraints: const BoxConstraints(minWidth: 90, minHeight: 20),
              child: const DecoratedBox(
                decoration: BoxDecoration(color: Colors.red),
              ),
            ),
          ),
          const SizedBox(height: 10),
          ConstrainedBox(
            constraints: const BoxConstraints(minWidth: 60, minHeight: 100),
            child: UnconstrainedBox(
              child: ConstrainedBox(
                constraints: const BoxConstraints(minWidth: 90, minHeight: 20),
                child: const DecoratedBox(
                  decoration: BoxDecoration(color: Colors.red),
                ),
              ),
            )
          ),
        ],
      ),
    );
  }
}
